package com.lrs.java.j2se_self.io;

import java.io.*;
public class TestBufferedIO {
	public static void main(String[] args){
		FileWriter fw = null;
		FileReader fr = null;
		String s = null;
		try{
			fr = new FileReader("D:\\javawork6.0\\eclipse Project\\eclipse3.3\\src\\io\\TestBufferedIO.txt");
			fw = new FileWriter("D:\\javawork6.0\\eclipse Project\\eclipse3.3\\src\\io\\TestBufferedIO.txt");
			BufferedReader br = new BufferedReader(fr);
			BufferedWriter bw = new BufferedWriter(fw);
			for(int i=0;i<100;i++){
				s = String.valueOf(Math.random());
				bw.write(s);
				bw.newLine();
			}
			bw.flush();
			while((s=br.readLine())!=null){
				System.out.println(s);
			}
			bw.close();
			br.close();
		}catch(IOException e){
			e.printStackTrace();
		}
		System.out.println("写入成功!");
	}
}
